# 1.导包
import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
# 2.打开浏览器（创建浏览器驱动对象）
driver = webdriver.Chrome()
# 3.输入网址（URL）
driver.get("http://121.43.169.97:8848/pageA.html")

# 需求：打开注册A页面，完成以下操作
# 1).通过脚本执行输入用户名：admin；密码：123456；电话号码：18611111111；电子邮件：123@qq.com
driver.find_element(By.ID, "userA").send_keys("admin")
driver.find_element(By.CSS_SELECTOR, "[name='passwordA']").send_keys("123456")
driver.find_element(By.CSS_SELECTOR, ".telA").send_keys("18611111111")
driver.find_element(By.XPATH, "//p[4]/input").send_keys("123@qq.com")
# 2).间隔3秒，修改电话号码为：18600000000
time.sleep(3)
driver.find_element(By.CSS_SELECTOR,".telA").clear()
driver.find_element(By.CSS_SELECTOR,".telA").send_keys("18600000000")

# 3).间隔3秒，点击‘注册’按钮
time.sleep(3)
driver.find_element(By.CSS_SELECTOR, "button").click()
# 4).间隔3秒，关闭浏览器
time.sleep(3)
driver.quit()
